package com.lastproject.web.bean;

import java.util.List;

import javax.ejb.EJB;

import com.lastproject.dto.BookDTO;
import com.lastproject.dto.BorrowedDTO;
import com.lastproject.dto.DomainDTO;
import com.lastproject.dto.ReviewDTO;
import com.lastproject.dto.UserDTO;
import com.lastproject.dto.WaitingListDTO;
import com.lastproject.ejb.dao.BookDAORemote;

//@ManagedBean
public class BookBean {

	@EJB
	BookDAORemote bookDAORemote;

	// @ManagedProperty(value = "#{bookDTO}")
	private BookDTO book;

	// @ManagedProperty(value = "#{borrowedDTO}")
	private List<BorrowedDTO> borroweds;

	// @ManagedProperty(value = "#{domainDTO}")
	private DomainDTO domain;

	// @ManagedProperty(value = "#{waitingListDTO}")
	private List<WaitingListDTO> waitingLists;

	// @ManagedProperty(value = "#{userDTO}")
	private List<UserDTO> users;

	private boolean availableToBorrow = true;

	private boolean availableToQueue = true;
	
	private Integer rating;

	private boolean ratingUser;

	private int currentUser;

	private List<ReviewDTO> reviews;

	public BookBean() {
	}

	public BookBean(BookDTO bookDTO) {
		this.book = bookDTO;
	}

	public List<ReviewDTO> getReviews() {
		return reviews;
	}

	public void setReviews(List<ReviewDTO> reviews) {
		this.reviews = reviews;
	}

	public DomainDTO getDomain() {
		return domain;
	}

	public void setDomain(DomainDTO domain) {
		this.domain = domain;
	}

	public List<BookDTO> getBooks() {
		return bookDAORemote.getAll();
	}

	public BookDTO getBook() {
		return book;
	}

	public void setBook(BookDTO bookDTO) {
		this.book = bookDTO;
	}

	public List<BorrowedDTO> getBorroweds() {
		return borroweds;
	}

	public void setBorroweds(List<BorrowedDTO> borroweds) {
		this.borroweds = borroweds;
	}

	public List<WaitingListDTO> getWaitingLists() {
		return waitingLists;
	}

	public void setWaitingLists(List<WaitingListDTO> waitingLists) {
		this.waitingLists = waitingLists;
	}

	public List<UserDTO> getUsers() {
		return users;
	}

	public void setUsers(List<UserDTO> users) {
		this.users = users;
	}

	public boolean isAvailableToBorrow() {
		return availableToBorrow;
	}

	public void setAvailableToBorrow(boolean availableToBorrow) {
		this.availableToBorrow = availableToBorrow;
	}

	public boolean isAvailableToQueue() {
		return availableToQueue;
	}

	public void setAvailableToQueue(boolean availableToQueue) {
		this.availableToQueue = availableToQueue;
	}

	public Integer getRating() {
		return rating;
	}

	public void setRating(Integer rating) {
		this.rating = rating;
	}

	public boolean isRatingUser() {
		return ratingUser;
	}

	public void setRatingUser(boolean ratingUser) {
		this.ratingUser = ratingUser;
	}

	public int getReviewsSize() {
		return reviews.size();
	}

	public int getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(int currentUser) {
		this.currentUser = currentUser;
	}

}
